<template>
    <div class="avue-logo">
        <transition name="fade">
            <span v-if="keyCollapse" key="0" class="avue-logo_subtitle">{{ website.logo }}</span>
        </transition>
        <transition-group name="fade">
            <template v-if="!keyCollapse">
                <div key="1" class="avue-logo_title">
                    <img src="/img/logo.png" alt />
                    <span>{{ title }}</span>
                    <span>企业微信营销平台</span>
                </div>
            </template>
        </transition-group>
    </div>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
    name: 'Logo',
    data() {
        return {
            title: ''
        };
    },
    created() {
        this.title = process.env.VUE_APP_NAME;
    },
    computed: {
        ...mapGetters(['website', 'keyCollapse', 'theme'])
    },
    methods: {}
};
</script>

<style lang="scss">
.fade-leave-active {
    transition: opacity 0.2s;
}
.fade-enter-active {
    transition: opacity 2.5s;
}
.fade-enter,
.fade-leave-to {
    opacity: 0;
}
.avue-logo {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 138px;
    font-size: 20px;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.8);
    z-index: 1024;
    &_title {
        padding: 10px 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 22px;
        font-weight: 500;
        img {
            width: 48px;
            height: 48px;
            border-radius: 50%;
        }
    }
    &_subtitle {
        display: block;
        text-align: center;
        font-size: 18px;
        font-weight: bold;
        color: #fff;
    }
}
.avue-logo_title {
    color: #fff;
    background: #ed5555;
}
</style>
